package com.study.example.study.extension.easyexcel.write;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.format.NumberFormat;
import com.alibaba.excel.annotation.write.style.*;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.util.Date;

/**
 * 写 demo 类
 *
 * @author RenYuLiang
 */
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
// 表头行高
@HeadRowHeight(40)
// 行高
@ContentRowHeight(20)
// 列宽
@ColumnWidth(20)

// 头背景设置成红色 IndexedColors.RED.getIndex()
//@HeadStyle(fillPatternType = FillPatternTypeEnum.SOLID_FOREGROUND, fillForegroundColor = 10)
// 头字体设置成 16
@HeadFontStyle(fontHeightInPoints = 16)
// 内容的背景设置成绿色 IndexedColors.GREEN.getIndex()
//@ContentStyle(fillPatternType = FillPatternTypeEnum.SOLID_FOREGROUND, fillForegroundColor = 17)
// 内容字体设置成 14
@ContentFontStyle(fontHeightInPoints = 14)
public class EasyExcelWriteDataDemoDTO implements Serializable {

    private static final long serialVersionUID = 5877762307870090347L;

    /**
     * 第1列
     */
    // 字符串的头背景设置成粉红 IndexedColors.PINK.getIndex()
    //@HeadStyle(fillPatternType = FillPatternTypeEnum.SOLID_FOREGROUND, fillForegroundColor = 14)
    // 字符串的头字体设置成20
    //@HeadFontStyle(fontHeightInPoints = 30)
    // 字符串的内容的背景设置成天蓝 IndexedColors.SKY_BLUE.getIndex()
    //@ContentStyle(fillPatternType = FillPatternTypeEnum.SOLID_FOREGROUND, fillForegroundColor = 40)
    // 字符串的内容字体设置成20
    //@ContentFontStyle(fontHeightInPoints = 30)
    @ColumnWidth(50)
    @ExcelProperty(index = 0, value = {"字符串标题"})
    private String string;
    /**
     * 第2列
     * 单独宽度为 30
     */
    @ColumnWidth(30)
    @ExcelProperty(index = 1, value = "日期标题")
    @DateTimeFormat("yyyy-MM-dd HH:mm:ss")
    private Date date;
    /**
     * 第3列
     */
    @ExcelProperty(index = 2, value = "数字标题")
    @NumberFormat("#.##%")
    private Double doubleData;
    /**
     * 第4列
     */
    @ExcelProperty(index = 3, value = "性别", converter = EasyExcelWriteGenderConverter.class)
    private Integer gender;
    /**
     * 第5列
     */
    @ExcelProperty(index = 4, value = "状态", converter = EasyExcelWriteStatusConverter.class)
    private String status;
    /**
     * 第6列
     */
    @ExcelProperty(index = 5, value = "空值", converter = EasyExcelWriteNullStrConverter.class)
    private String nullStr;
    /**
     * 忽略该字段
     */
    @ExcelIgnore
    private String ignore;

}
